﻿using System.Collections.Generic;

namespace Basefr.Core.Entities
{
    /// <summary>
    /// 自引用对象接口
    /// </summary>
    public interface ISelfReference<TEntity, TPrimaryKey> where TEntity : EntityBase<TPrimaryKey>
        where TPrimaryKey : struct
    {
        TPrimaryKey? ParentId { get; set; }

        TEntity Parent { get; set; }

        int Level { get; set; }

        List<TEntity> Children { get; set; }
    }

    public interface ISelfReference<TEntity> : ISelfReference<TEntity, int> where TEntity : EntityBase<int>
    {

    }
}
